package io.libp2p.example.chat;

public class DataCmd {
    public static final String CMD_FILE_START = "file_data_start";
    public static final String CMD_FILE_DATA = "file_data_package";
    public static final String CMD_FILE_END = "file_data_end";

    public static final String CMD_SOCKET_CLIENT = "socket_data_client";
    public static final String CMD_SOCKET_SERVER = "socket_data_server";
    public static final String CMD_SOCKET_CLOSE = "socket_data_server_close";
    public static final String CMD_CLIENT_CLOSE = "socket_data_client_close";

    public DataCmd(String fileId, String cmd, String fileName){
        this.fileId = fileId;
        this.cmd = cmd;
        this.fileName = fileName;
    }

    public DataCmd(String fileId, String cmd){
        this.fileId = fileId;
        this.cmd = cmd;
    }

    public static DataCmd parseFileData(String fileId, String base64){
        DataCmd dataCmd = new DataCmd(fileId, CMD_FILE_DATA);
        dataCmd.zbase64 = base64;
        return dataCmd;
    }

    public static DataCmd parseFileData(String fileId, String cmd, String base64){
        DataCmd dataCmd = new DataCmd(fileId, cmd);
        dataCmd.zbase64 = base64;
        return dataCmd;
    }

    public static DataCmd parseCommand(String fileId, String cmd){
        DataCmd dataCmd = new DataCmd(fileId, cmd);
        return dataCmd;
    }

    public String fileId;

    public String fileName;

    public String cmd;

    public long fileSize;

    public String zbase64;


}
